package com.lovo.testjpa.bean.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.domain.Page;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageVO {
    private Integer pageNum;
    private Integer pageSize;
    private Object list;
    private Long total;
    private Integer totalPage;
    public PageVO(Page page){
        this.setList(page.getContent());
        this.setPageNum(page.getPageable().getPageNumber() + 1);
        this.setPageSize(page.getPageable().getPageSize());
        this.setTotal(page.getTotalElements());
        this.setTotalPage(page.getTotalPages());
    }

}
